package com.financing.platform.dto;

import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.financing.platform.common.CsvExportable;
import com.financing.platform.util.DateUtil;
import com.financing.platform.util.StringUtil;

public class ActivitiesGroupDTO extends BaseDTO implements CsvExportable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -327930185754953453L;
	
	/**
	 * 记录ID
	 */
	private Integer id;

	/**
	 * 组团团ID
	 */
	private String fpGroupId;
	
	/**
	 * 团名称
	 */
	private String fpGroupName;
	
	/**
	 * 团创建时间
	 */
	private Date fpGroupCreateTime;
	
	/**
	 * 团成员ID
	 */
	private String fpFaId;
	
	/**
	 * 团成员姓名
	 */
	private String fpFaName;
	
	/**
	 * 团成员手机号
	 */
	private String fpFaMobile;


	/**
	 * 团总成员数
	 */
	private Integer fpGroupTotalMember;
	
	/**
	 * 团成功认证人数
	 */
	private Integer fpGroupSuccessMember;
	
	/**
	 * 参团总人数
	 */
	private Integer fpGroupAllMember;
	
	/**
	 * 参团认证失败人数
	 */
	private Integer fpGroupFailMember;
	
	/**
	 * 参团认证中
	 */
	private Integer fpGroupZhongMember;
	
	/**
	 * 队长FaId
	 */
	private String fpGroupHeadId;
	
	/**
	 * 当前团总奖金金额
	 */
	private BigDecimal fpGroupTotalAmount;
	
	/**
	 *  当前成员已发放金额
	 */
	private BigDecimal fpGroupSendAmount;
	
	/**
	 * 团状态  1：已创建 2： 组团成功结束  3：组团失败结束 4：组团超时
	 */
	private String fpGroupStatus;
	
	/**
	 * 成团起始时间
	 */
	private Date fpGroupSuccessTimeBegin;
	
	/**
	 * 成团结束时间
	 */
	private Date fpGroupSuccessTimeEnd;
	
	/**
	 * 成团起始时间Str
	 */
	private String fpGroupSuccessTimeBeginStr;
	
	/**
	 * 成团结束时间Str
	 */
	private String fpGroupSuccessTimeEndStr;
	
	/**
	 * 组团成功时间
	 */
	private Date fpGroupSuccessTime;
	
	/**
	 * 红包发放状态
	 */
	private String fpGroupSendAmountStatus;
	

	/**
	 * 团主手机号
	 */
	private String uMobile;
	
	/**
	 * 是否领过红包
	 */
	private Boolean hadGetGift;
	
	/**
	 * 团成员认证情况
	 */
	private String fpFaRole;
	
	public Date getFpGroupSuccessTimeBegin() {
		return fpGroupSuccessTimeBegin;
	}

	public void setFpGroupSuccessTimeBegin(Date fpGroupSuccessTimeBegin) {
		this.fpGroupSuccessTimeBegin = fpGroupSuccessTimeBegin;
	}

	public Date getFpGroupSuccessTimeEnd() {
		return fpGroupSuccessTimeEnd;
	}

	public void setFpGroupSuccessTimeEnd(Date fpGroupSuccessTimeEnd) {
		this.fpGroupSuccessTimeEnd = fpGroupSuccessTimeEnd;
	}

	public String getFpGroupId() {
		return fpGroupId;
	}

	public void setFpGroupId(String fpGroupId) {
		this.fpGroupId = fpGroupId;
	}

	public String getFpGroupName() {
		return fpGroupName;
	}

	public void setFpGroupName(String fpGroupName) {
		this.fpGroupName = fpGroupName;
	}

	public Date getFpGroupCreateTime() {
		return fpGroupCreateTime;
	}

	public void setFpGroupCreateTime(Date fpGroupCreateTime) {
		this.fpGroupCreateTime = fpGroupCreateTime;
	}

	public Integer getFpGroupTotalMember() {
		return fpGroupTotalMember;
	}

	public void setFpGroupTotalMember(Integer fpGroupTotalMember) {
		this.fpGroupTotalMember = fpGroupTotalMember;
	}

	public String getFpFaId() {
		return fpFaId;
	}

	public void setFpFaId(String fpFaId) {
		this.fpFaId = fpFaId;
	}

	public String getFpGroupHeadId() {
		return fpGroupHeadId;
	}

	public void setFpGroupHeadId(String fpGroupHeadId) {
		this.fpGroupHeadId = fpGroupHeadId;
	}

	public BigDecimal getFpGroupTotalAmount() {
		return fpGroupTotalAmount;
	}

	public void setFpGroupTotalAmount(BigDecimal fpGroupTotalAmount) {
		this.fpGroupTotalAmount = fpGroupTotalAmount;
	}

	public BigDecimal getFpGroupSendAmount() {
		return fpGroupSendAmount;
	}

	public void setFpGroupSendAmount(BigDecimal fpGroupSendAmount) {
		this.fpGroupSendAmount = fpGroupSendAmount;
	}

	public String getFpGroupStatus() {
		return fpGroupStatus;
	}

	public void setFpGroupStatus(String fpGroupStatus) {
		this.fpGroupStatus = fpGroupStatus;
	}

	public String getuMobile() {
		return uMobile;
	}

	public void setuMobile(String uMobile) {
		this.uMobile = uMobile;
	}

	public Boolean getHadGetGift() {
		return hadGetGift;
	}

	public void setHadGetGift(Boolean hadGetGift) {
		this.hadGetGift = hadGetGift;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	public String getFpGroupSendAmountStatus() {
		return fpGroupSendAmountStatus;
	}

	public void setFpGroupSendAmountStatus(String fpGroupSendAmountStatus) {
		this.fpGroupSendAmountStatus = fpGroupSendAmountStatus;
	}

	public Date getFpGroupSuccessTime() {
		return fpGroupSuccessTime;
	}

	public void setFpGroupSuccessTime(Date fpGroupSuccessTime) {
		this.fpGroupSuccessTime = fpGroupSuccessTime;
	}

	public String getFpFaName() {
		return fpFaName;
	}

	public void setFpFaName(String fpFaName) {
		this.fpFaName = fpFaName;
	}
	
	public String getFpFaMobile() {
		return fpFaMobile;
	}

	public void setFpFaMobile(String fpFaMobile) {
		this.fpFaMobile = fpFaMobile;
	}

	public String getFpFaRole() {
		return fpFaRole;
	}

	public void setFpFaRole(String fpFaRole) {
		this.fpFaRole = fpFaRole;
	}

	public Integer getFpGroupSuccessMember() {
		return fpGroupSuccessMember;
	}

	public void setFpGroupSuccessMember(Integer fpGroupSuccessMember) {
		this.fpGroupSuccessMember = fpGroupSuccessMember;
	}

	@Override
	public String csvTitle() {
		return "团编号,成团时间,团名称,团大小,认证用户数,团长姓名,团长手机号,团状态,是否领红包";
	}

	@Override
	public String toCsvString() {
		StringBuffer sb = new StringBuffer();
		sb.append(fpGroupId)
		  .append(",")
		  .append(formatDate(fpGroupSuccessTime))
		  .append(",")
		  .append(fpGroupName)
		  .append(",")
		  .append(fpGroupTotalMember.toString())
		  .append(",")
		  .append(fpGroupSuccessMember.toString())
		  .append(",")
		  .append(fpFaName)
		  .append(",")
		  .append(fpFaMobile.toString())
		  .append(",")
		  .append(resolveGroupStatus(fpGroupStatus))
		  .append(",")
		  .append(resolveHadGetGift(hadGetGift));
		return sb.toString();
	}
	
	
	private String formatDate(Date date){
		DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
		if(date == null){
			return "团未成功";
		}
		return  df.format(date);
	}
	
	private String resolveHadGetGift(Boolean hadGetGift){
		if(!hadGetGift){
			return "未领";
		}else{
			return "已领";
		}
	}
	
	private String resolveGroupStatus(String fpGroupStatus){
		if(StringUtil.isNullOrEmptyStr(fpGroupStatus)){
			return "";
		}
		if("1".equals(fpGroupStatus)){
			return "已创建";
		}else if("2".equals(fpGroupStatus)){
			return "组团成功";
		}else if("3".equals(fpGroupStatus)){
			return "组团失败";
		}else if("4".equals(fpGroupStatus)){
			return "组团超时";
		}else{
			return "";
		}
	}

	public String getFpGroupSuccessTimeBeginStr() {
		return fpGroupSuccessTimeBeginStr;
	}

	public void setFpGroupSuccessTimeBeginStr(String fpGroupSuccessTimeBeginStr) {
		if(!StringUtil.isNullOrEmptyStr(fpGroupSuccessTimeBeginStr)){
			this.fpGroupSuccessTimeBegin = DateUtil.parseDateString(fpGroupSuccessTimeBeginStr, "yyyy-MM-dd");
		}
		this.fpGroupSuccessTimeBeginStr = fpGroupSuccessTimeBeginStr;
		
	}

	public String getFpGroupSuccessTimeEndStr() {
		return fpGroupSuccessTimeEndStr;
	}

	public void setFpGroupSuccessTimeEndStr(String fpGroupSuccessTimeEndStr) {
		if(!StringUtil.isNullOrEmptyStr(fpGroupSuccessTimeEndStr)){
			this.fpGroupSuccessTimeEnd = DateUtil.parseDateString(fpGroupSuccessTimeEndStr, "yyyy-MM-dd");
		}
		this.fpGroupSuccessTimeEndStr = fpGroupSuccessTimeEndStr;
	}

	public Integer getFpGroupAllMember() {
		return fpGroupAllMember;
	}

	public void setFpGroupAllMember(Integer fpGroupAllMember) {
		this.fpGroupAllMember = fpGroupAllMember;
	}

	public Integer getFpGroupFailMember() {
		return fpGroupFailMember;
	}

	public void setFpGroupFailMember(Integer fpGroupFailMember) {
		this.fpGroupFailMember = fpGroupFailMember;
	}

	public Integer getFpGroupZhongMember() {
		return fpGroupZhongMember;
	}

	public void setFpGroupZhongMember(Integer fpGroupZhongMember) {
		this.fpGroupZhongMember = fpGroupZhongMember;
	}
	
}
